<?php
namespace Ffan\Eagle;

class EagleException{
    const DATA_ERROR_ARRAY_EMPTY        = 1001;
    const DATA_ERROR_VALUES_ALL_EMPTY   = 1002;
    const DATA_ERROR_VALUES_HAS_EMPTY   = 1002;
    const TAG_ERROR_VALUES_HAS_EMPTY    = 1003;
    const MEASUREMENT_IS_EMPTY          = 1004;
    const AGGREGATE_VALUE_ERROR         = 1005;

    public static $errMsg = [
        self::DATA_ERROR_ARRAY_EMPTY        =>'数据数组为空',
        self::DATA_ERROR_VALUES_ALL_EMPTY   =>'数据值都为空',
        self::DATA_ERROR_VALUES_HAS_EMPTY   =>'数据存在空值',
        self::TAG_ERROR_VALUES_HAS_EMPTY    =>'标签存在空值',
        self::MEASUREMENT_IS_EMPTY          =>'埋点名称为空',
        self::AGGREGATE_VALUE_ERROR         =>'聚合查询类型错误'
    ];

    public static function getException($code){
        $msg = '异常错误';
        if(isset(self::$errMsg[$code])){
            $msg = self::$errMsg[$code];
        }

        throw new \Exception($msg, $code);
    }

}